#To-do: 1. Snowcover effects on clp abund for all lakes where the DB has multiple CLP projects - non-local winter data -

  1. Compare my results to old ones! Lake past, neighbors, watershed, state?

Prep WS

#load libraries
library(data.table)
library(tidyr)
library(stringr)
library(ggplot2)
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
#import Data
surveys <- fread("scripts&data/data/input/lake_year_data.csv")
rawdata <- fread("scripts&data/data/input/PCRIsurveysPICharter2srt_sheet1rawdata.csv")

#data explore

#see if we can re-generate ray's calc'd CLP values
head(rawdata)
##       V1 SUBMITTER_NAME SUBMITTER_EMAIL     DOW SURVEY_START RAKE_MAX
##    <int>         <char>          <char>   <int>       <char>   <char>
## 1: 34744  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
## 2: 34745  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
## 3: 34746  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
## 4: 34747  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
## 5: 34748  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
## 6: 34749  DNR Fisheries            <NA> 1000100    6/25/2008  Unknown
##    SUBMIT_TIME                       SURVEYORS sta_nbr latitude longitude
##         <char>                          <char>  <char>    <num>     <num>
## 1:        <NA> Unnamed hardworking surveyor(s)   18520 46.17630 -93.09180
## 2:        <NA> Unnamed hardworking surveyor(s)   18521 46.17681 -93.08801
## 3:        <NA> Unnamed hardworking surveyor(s)   18522 46.18594 -93.07455
## 4:        <NA> Unnamed hardworking surveyor(s)   18523 46.18594 -93.07371
## 5:        <NA> Unnamed hardworking surveyor(s)   18524 46.18594 -93.07287
## 6:        <NA> Unnamed hardworking surveyor(s)   18525 46.18594 -93.07202
##    depth_ft substrate whole_rake_density myriophyllum_spicatum
##      <char>    <char>              <int>                <char>
## 1:      2.3      <NA>                 NA                     0
## 2:      4.8      <NA>                 NA                     0
## 3:      6.3      <NA>                 NA                     0
## 4:      7.5      <NA>                 NA                     0
## 5:      3.1      <NA>                 NA                     0
## 6:        1      <NA>                 NA                     0
##    potamogeton_crispus ceratophyllum_demersum chara_sp elodea_canadensis
##                 <char>                 <char>   <char>            <char>
## 1:                   0                      0        0                 0
## 2:                   0                      0        0                 1
## 3:                   0                      1        0                 0
## 4:                   0                      0        0                 0
## 5:                   1                      1        0                 0
## 6:                   0                      0        0                 0
##    lemna_minor lemna_trisulca nitella_sp nymphaea_odorata phalaris_arundinacea
##         <char>         <char>      <int>           <char>               <char>
## 1:           0              1          0                0                    0
## 2:           0              1          0                0                    0
## 3:           0              0          0                0                    0
## 4:           0              0          0                0                    0
## 5:           0              1          0                0                    0
## 6:           0              0          0                0                    0
##    potamogeton_amplifolius potamogeton_foliosus potamogeton_pusillus
##                     <char>               <char>               <char>
## 1:                       0                    0                    0
## 2:                       0                    0                    0
## 3:                       0                    0                    0
## 4:                       0                    0                    0
## 5:                       1                    0                    0
## 6:                       0                    0                    0
##    potamogeton_robbinsii potamogeton_zosteriformis ranunculus_aquatilis
##                   <char>                    <char>               <char>
## 1:                     0                         1                    0
## 2:                     0                         0                    0
## 3:                     0                         0                    0
## 4:                     0                         0                    0
## 5:                     0                         0                    0
## 6:                     0                         0                    0
##    spirodela_polyrrhiza typha_angustifolia vallisneria_americana
##                  <char>             <char>                <char>
## 1:                    1                  0                     0
## 2:                    0                  0                     0
## 3:                    0                  0                     0
## 4:                    0                  0                     0
## 5:                    0                  0                     0
## 6:                    0                  0                     0
##    wolffia_columbiana aquatic_moss heteranthera_dubia najas_guadalupensis
##                 <int>       <char>             <char>              <char>
## 1:                  0         <NA>                  0                   0
## 2:                  0         <NA>                  0                   0
## 3:                  0         <NA>                  0                   0
## 4:                  0         <NA>                  0                   0
## 5:                  0         <NA>                  0                   0
## 6:                  0         <NA>                  0                   0
##    phragmites_australis potamogeton_friesii potamogeton_gramineus
##                  <char>              <char>                 <int>
## 1:                    0                   0                     0
## 2:                    0                   0                     0
## 3:                    0                   0                     0
## 4:                    0                   0                     0
## 5:                    0                   0                     0
## 6:                    0                   0                     0
##    potamogeton_illinoensis potamogeton_natans schoenoplectus_acutus
##                     <char>             <char>                <char>
## 1:                       0                  0                     1
## 2:                       0                  0                     0
## 3:                       0                  0                     0
## 4:                       0                  0                     0
## 5:                       0                  0                     0
## 6:                       0                  0                     0
##    stuckenia_pectinata lythrum_salicaria brasenia_schreberi
##                 <char>            <char>             <char>
## 1:                   0                 0                  0
## 2:                   0                 0                  0
## 3:                   0                 0                  0
## 4:                   0                 0                  0
## 5:                   0                 0                  0
## 6:                   0                 0                  0
##    eleocharis_acicularis eleocharis_erythropoda najas_flexilis
##                   <char>                 <char>         <char>
## 1:                     0                      0              0
## 2:                     0                      0              0
## 3:                     0                      0              0
## 4:                     0                      0              0
## 5:                     0                      0              0
## 6:                     0                      0              0
##    potamogeton_nodosus potamogeton_praelongus sagittaria_rigida
##                 <char>                 <char>            <char>
## 1:                   0                      0                 0
## 2:                   0                      0                 0
## 3:                   0                      0                 0
## 4:                   0                      0                 0
## 5:                   0                      0                 0
## 6:                   0                      0                 0
##    schoenoplectus_tabernaemontani lychnothamnus_barbatus
##                            <char>                 <char>
## 1:                              1                      0
## 2:                              0                      0
## 3:                              0                      0
## 4:                              0                      0
## 5:                              0                      0
## 6:                              0                      0
##    calamagrostis_canadensis utricularia_vulgaris zannichellia_palustris
##                      <char>               <char>                 <char>
## 1:                        0                    0                      0
## 2:                        0                    0                      0
## 3:                        0                    0                      0
## 4:                        0                    0                      0
## 5:                        0                    0                      0
## 6:                        0                    0                      0
##    alisma_triviale bolboschoenus_fluviatilis myriophyllum_sibiricum
##             <char>                    <char>                 <char>
## 1:               0                         0                      0
## 2:               0                         0                      0
## 3:               0                         0                      0
## 4:               0                         0                      0
## 5:               0                         0                      0
## 6:               0                         0                      0
##    sagittaria_latifolia sagittaria_montevidensis sparganium_eurycarpum
##                  <char>                   <char>                <char>
## 1:                    0                     <NA>                     0
## 2:                    0                     <NA>                     0
## 3:                    0                     <NA>                     0
## 4:                    0                     <NA>                     0
## 5:                    0                     <NA>                     0
## 6:                    0                     <NA>                     0
##    leersia_oryzoides iris_pseudacorus iris_virginica ceratophyllum_echinatum
##               <char>           <char>         <char>                  <char>
## 1:                 0             <NA>              0                       0
## 2:                 0             <NA>              0                       0
## 3:                 0             <NA>              0                       0
## 4:                 0             <NA>              0                       0
## 5:                 0             <NA>              0                       0
## 6:                 0             <NA>              0                       0
##    riccia_fluitans potamogeton_richardsonii nuphar_variegata
##             <char>                   <char>           <char>
## 1:               0                        0                0
## 2:               0                        0                0
## 3:               0                        0                0
## 4:               0                        0                0
## 5:               0                        0                1
## 6:               0                        1                1
##    myriophyllum_spicatum_x_sibiricum sagittaria_cristata najas_minor
##                               <char>              <char>      <char>
## 1:                              <NA>                   0           0
## 2:                              <NA>                   0           0
## 3:                              <NA>                   0           0
## 4:                              <NA>                   0           0
## 5:                              <NA>                   0           0
## 6:                              <NA>                   0           0
##    carex_comosa typha_x_glauca carex_pellita carex_scoparia sagittaria_sp
##          <char>         <char>         <int>          <int>        <char>
## 1:            0              0             0              0             0
## 2:            0              0             0              0             0
## 3:            0              0             0              0             0
## 4:            0              0             0              0             0
## 5:            0              0             0              0             0
## 6:            0              0             0              0             0
##    sparganium_sp iris_sp sta_nbr.1 stuckenia_filiformis sta_nbr.2 scirpus_sp
##            <int>   <int>    <char>                <int>    <lgcl>     <char>
## 1:             0       0      <NA>                    0        NA          0
## 2:             0       0      <NA>                    0        NA          0
## 3:             0       0      <NA>                    0        NA          0
## 4:             0       0      <NA>                    0        NA          0
## 5:             0       0      <NA>                    0        NA          0
## 6:             0       0      <NA>                    0        NA          0
##    utricularia_minor riccia_sp wolffia_sp nitella_furcata juncus_pelocarpus
##               <char>     <int>     <char>          <lgcl>             <int>
## 1:                 0         0          0              NA                 0
## 2:                 0         0          0              NA                 0
## 3:                 0         0          0              NA                 0
## 4:                 0         0          0              NA                 0
## 5:                 0         0          0              NA                 0
## 6:                 0         0          0              NA                 0
##    nelumbo_lutea isoetes_echinospora sagittaria_graminea cyperus_sp
##           <char>               <int>               <int>     <lgcl>
## 1:             0                   0                   0         NA
## 2:             0                   0                   0         NA
## 3:             0                   0                   0         NA
## 4:             0                   0                   0         NA
## 5:             0                   0                   0         NA
## 6:             0                   0                   0         NA
##    hydrocotyle_ranunculoides bidens_beckii nitella_tenuissima nitella_flexilis
##                        <int>         <int>             <lgcl>           <lgcl>
## 1:                        NA             0                 NA               NA
## 2:                        NA             0                 NA               NA
## 3:                        NA             0                 NA               NA
## 4:                        NA             0                 NA               NA
## 5:                        NA             0                 NA               NA
## 6:                        NA             0                 NA               NA
##    typha_sp drepanocladus_sp najas_sp utricularia_sp utricularia_sp.1
##      <char>            <int>    <int>          <int>           <lgcl>
## 1:        0                0        0              0               NA
## 2:        0                0        0              0               NA
## 3:        0                0        0              0               NA
## 4:        0                0        0              0               NA
## 5:        0                0        0              0               NA
## 6:        0                0        0              0               NA
##    ranunculus_sp chara_sp.1 elodea_sp hippuris_vulgaris caltha_palustris
##            <int>     <lgcl>     <int>             <int>            <int>
## 1:             0         NA         0                 0                0
## 2:             0         NA         0                 0                0
## 3:             0         NA         0                 0                0
## 4:             0         NA         0                 0                0
## 5:             0         NA         0                 0                0
## 6:             0         NA         0                 0                0
##    potamogeton_strictifolius no_veg_found elodea_nuttallii lemna_sp
##                        <int>       <char>            <int>    <num>
## 1:                         0         <NA>                0        0
## 2:                         0         <NA>                0        0
## 3:                         0         <NA>                0        0
## 4:                         0         <NA>                0        0
## 5:                         0         <NA>                0        0
## 6:                         0         <NA>                0        0
##    ludwigia_palustris myriophyllum_verticillatum najas_marina
##                 <int>                     <char>        <int>
## 1:                 NA                          0            0
## 2:                 NA                          0            0
## 3:                 NA                          0            0
## 4:                 NA                          0            0
## 5:                 NA                          0            0
## 6:                 NA                          0            0
##    persicaria_amphibia stuckenia_vaginata solanum_dulcamara
##                 <char>              <int>            <lgcl>
## 1:                   0                  0                NA
## 2:                   0                  0                NA
## 3:                   0                  0                NA
## 4:                   0                  0                NA
## 5:                   0                  0                NA
## 6:                   0                  0                NA
##    schoenoplectus_pungens lake_name plant_height surface_growth
##                     <int>    <char>        <num>          <num>
## 1:                      0      pine           NA             NA
## 2:                      0      pine           NA             NA
## 3:                      0      pine           NA             NA
## 4:                      0      pine           NA             NA
## 5:                      0      pine           NA             NA
## 6:                      0      pine           NA             NA
##    equisetum_fluviatile fontinalis_antipyretica lemna_turionifera     x     y
##                  <char>                   <int>             <int> <num> <num>
## 1:                    0                       0                 0    NA    NA
## 2:                    0                       0                 0    NA    NA
## 3:                    0                       0                 0    NA    NA
## 4:                    0                       0                 0    NA    NA
## 5:                    0                       0                 0    NA    NA
## 6:                    0                       0                 0    NA    NA
##    utricularia_gibba nostoc_sp bidens_cernua phragmites_australis_americanus
##                <int>    <lgcl>        <lgcl>                          <lgcl>
## 1:                 0        NA            NA                              NA
## 2:                 0        NA            NA                              NA
## 3:                 0        NA            NA                              NA
## 4:                 0        NA            NA                              NA
## 5:                 0        NA            NA                              NA
## 6:                 0        NA            NA                              NA
##    potamogeton_sp potamogeton_obtusifolius typha_latifolia lemna_gibba
##             <int>                    <int>           <int>      <lgcl>
## 1:              0                        0               0          NA
## 2:              0                        0               0          NA
## 3:              0                        0               0          NA
## 4:              0                        0               0          NA
## 5:              0                        0               0          NA
## 6:              0                        0               0          NA
##    potamogeton_alpinus dulichium_arundinaceum phragmites_australis_australis
##                  <int>                  <int>                         <lgcl>
## 1:                   0                      0                             NA
## 2:                   0                      0                             NA
## 3:                   0                      0                             NA
## 4:                   0                      0                             NA
## 5:                   0                      0                             NA
## 6:                   0                      0                             NA
##    acorus_americanus sparganium_emersum zizania_palustris nitellopsis_obtusa
##                <int>              <int>            <char>              <int>
## 1:                 0                  0                 0                  0
## 2:                 0                  0                 0                  0
## 3:                 0                  0                 0                  0
## 4:                 0                  0                 0                  0
## 5:                 0                  0                 0                  0
## 6:                 0                  0                 0                  0
##    ranunculus_flabellaris phragmites_sp zizania_sp chara_contraria
##                     <int>        <lgcl>      <int>          <lgcl>
## 1:                      0            NA          0              NA
## 2:                      0            NA          0              NA
## 3:                      0            NA          0              NA
## 4:                      0            NA          0              NA
## 5:                      0            NA          0              NA
## 6:                      0            NA          0              NA
##    chara_braunii schoenoplectus_heterochaetus sagittaria_cuneata
##           <lgcl>                       <lgcl>              <int>
## 1:            NA                           NA                  0
## 2:            NA                           NA                  0
## 3:            NA                           NA                  0
## 4:            NA                           NA                  0
## 5:            NA                           NA                  0
## 6:            NA                           NA                  0
##    ranunculus_flammula pontederia_cordata nitella_macounii isoetes_lacustris
##                  <int>              <int>           <lgcl>            <lgcl>
## 1:                   0                  0               NA                NA
## 2:                   0                  0               NA                NA
## 3:                   0                  0               NA                NA
## 4:                   0                  0               NA                NA
## 5:                   0                  0               NA                NA
## 6:                   0                  0               NA                NA
##    lobelia_dortmanna myriophyllum_tenellum iris_versicolor carex_stricta
##                <int>                 <int>           <int>        <char>
## 1:                 0                     0               0          <NA>
## 2:                 0                     0               0          <NA>
## 3:                 0                     0               0          <NA>
## 4:                 0                     0               0          <NA>
## 5:                 0                     0               0          <NA>
## 6:                 0                     0               0          <NA>
##    veronica_catenata eleocharis_palustris nymphaea_odorata.1 nuphar_advena
##               <char>                <int>              <int>         <int>
## 1:              <NA>                    0                  0             0
## 2:              <NA>                    0                  0             0
## 3:              <NA>                    0                  0             0
## 4:              <NA>                    0                  0             0
## 5:              <NA>                    0                  0             0
## 6:              <NA>                    0                  0             0
##    utm_crs heteranthera_dubia.1 plant_height_m carex_sp utricularia_geminiscapa
##      <int>               <lgcl>         <lgcl>    <int>                   <int>
## 1:      NA                   NA             NA        0                       0
## 2:      NA                   NA             NA        0                       0
## 3:      NA                   NA             NA        0                       0
## 4:      NA                   NA             NA        0                       0
## 5:      NA                   NA             NA        0                       0
## 6:      NA                   NA             NA        0                       0
##    carex_lacustris najas_sp.1 unk_sp typha_latifolia.1 impatiens_sp
##              <int>     <lgcl>  <int>            <lgcl>        <int>
## 1:               0         NA     NA                NA            0
## 2:               0         NA     NA                NA            0
## 3:               0         NA     NA                NA            0
## 4:               0         NA     NA                NA            0
## 5:               0         NA     NA                NA            0
## 6:               0         NA     NA                NA            0
##    rumex_britannica thelypteris_palustris characeae potamogeton_perfoliatus
##               <int>                <lgcl>     <int>                  <lgcl>
## 1:                0                    NA        NA                      NA
## 2:                0                    NA        NA                      NA
## 3:                0                    NA        NA                      NA
## 4:                0                    NA        NA                      NA
## 5:                0                    NA        NA                      NA
## 6:                0                    NA        NA                      NA
##    potamogeton_epihydrus schoenoplectus_sp not_sampled utricularia_intermedia
##                    <int>             <int>      <lgcl>                  <int>
## 1:                     0                 0          NA                      0
## 2:                     0                 0          NA                      0
## 3:                     0                 0          NA                      0
## 4:                     0                 0          NA                      0
## 5:                     0                 0          NA                      0
## 6:                     0                 0          NA                      0
##    survey_notes  algae algae.1 nuphar_sp nymphaea_sp equisetum_sp
##          <char> <char>   <int>    <char>      <char>        <int>
## 1:         <NA>   <NA>      NA         1           1            1
## 2:         <NA>   <NA>      NA         0           0            0
## 3:         <NA>   <NA>      NA         0           0            0
## 4:         <NA>   <NA>      NA         0           0            0
## 5:         <NA>   <NA>      NA         0           0            0
## 6:         <NA>   <NA>      NA         0           0            0
##    freshwater_sponge myriophyllum_sp potamogeton_spirillus sparganium_fluctuans
##               <lgcl>           <int>                 <int>                <int>
## 1:                NA               0                     0                    0
## 2:                NA               0                     0                    0
## 3:                NA               0                     0                    0
## 4:                NA               0                     0                    0
## 5:                NA               0                     0                    0
## 6:                NA               0                     0                    0
##    subbasin multipartsurvey acorus_sp alisma_sp alnus_sp andromeda_polifolia
##      <char>           <num>     <int>     <int>    <int>               <int>
## 1:                       NA         0         0        0                   0
## 2:                       NA         0         0        0                   0
## 3:                       NA         0         0        0                   0
## 4:                       NA         0         0        0                   0
## 5:                       NA         0         0        0                   0
## 6:                       NA         0         0        0                   0
##    asclepias_incarnata asteraceae_taxa azolla_microphylla betula_pumila
##                  <int>           <int>              <int>         <int>
## 1:                   0               0                  0             0
## 2:                   0               0                  0             0
## 3:                   0               0                  0             0
## 4:                   0               0                  0             0
## 5:                   0               0                  0             0
## 6:                   0               0                  0             0
##    bidens_sp bolboschoenus_maritimus boltonia_asteroides butomus_umbellatus
##        <int>                   <int>               <int>              <int>
## 1:         0                      NA                   0                  0
## 2:         0                      NA                   0                  0
## 3:         0                      NA                   0                  0
## 4:         0                      NA                   0                  0
## 5:         0                      NA                   0                  0
## 6:         0                      NA                   0                  0
##    calla_palustris callitriche_sp carex_aquatilis ceratophyllum_sp
##              <int>          <int>           <int>            <int>
## 1:               0              0               0                0
## 2:               0              0               0                0
## 3:               0              0               0                0
## 4:               0              0               0                0
## 5:               0              0               0                0
## 6:               0              0               0                0
##    chamaedaphne_calyculata chara_canescens chara_globularis characeae_taxa
##                      <int>           <int>            <int>          <int>
## 1:                       0               0                0              0
## 2:                       0               0                0              0
## 3:                       0               0                0              0
## 4:                       0               0                0              0
## 5:                       0               0                0              0
## 6:                       0               0                0              0
##    cicuta_sp cicuta_maculata cyperaceae_taxa drepanocladus_aduncus elatine_sp
##        <int>           <int>           <int>                 <int>      <int>
## 1:         0               0               0                     0          0
## 2:         0               0               0                     0          0
## 3:         0               0               0                     0          0
## 4:         0               0               0                     0          0
## 5:         0               0               0                     0          0
## 6:         0               0               0                     0          0
##    elatine_minima eleocharis_sp eleocharis_robbinsii eragrostis_sp
##             <int>         <int>                <int>         <int>
## 1:              0             0                    0             0
## 2:              0             0                    0             0
## 3:              0             0                    0             0
## 4:              0             0                    0             0
## 5:              0             0                    0             0
## 6:              0             0                    0             0
##    eriocaulon_aquaticum eutrochium_dubium eutrochium_maculatum
##                   <int>             <int>                <int>
## 1:                    0                 0                    0
## 2:                    0                 0                    0
## 3:                    0                 0                    0
## 4:                    0                 0                    0
## 5:                    0                 0                    0
## 6:                    0                 0                    0
##    eupatorium_perfoliatum eutrochium_sp fontinalis_sullivantii
##                     <int>         <int>                  <int>
## 1:                      0             0                      0
## 2:                      0             0                      0
## 3:                      0             0                      0
## 4:                      0             0                      0
## 5:                      0             0                      0
## 6:                      0             0                      0
##    glyceria_borealis hypericum_sp hypericum_ellipticum impatiens_capensis
##                <int>        <int>                <int>              <int>
## 1:                 0            0                    0                  0
## 2:                 0            0                    0                  0
## 3:                 0            0                    0                  0
## 4:                 0            0                    0                  0
## 5:                 0            0                    0                  0
## 6:                 0            0                    0                  0
##    isoetes_sp juncus_sp juncus_arcticus juncus_canadensis juncus_effusus
##         <int>     <int>           <int>             <int>          <int>
## 1:          0         0               0                 0              0
## 2:          0         0               0                 0              0
## 3:          0         0               0                 0              0
## 4:          0         0               0                 0              0
## 5:          0         0               0                 0              0
## 6:          0         0               0                 0              0
##    lamiaceae_taxa rhododendron_groenlandicum littorella_uniflora
##             <int>                      <int>               <int>
## 1:              0                          0                   0
## 2:              0                          0                   0
## 3:              0                          0                   0
## 4:              0                          0                   0
## 5:              0                          0                   0
## 6:              0                          0                   0
##    lycopus_americanus lysimachia_sp lysimachia_terrestris menyanthes_trifoliata
##                 <int>         <int>                 <int>                 <int>
## 1:                  0             0                     0                     0
## 2:                  0             0                     0                     0
## 3:                  0             0                     0                     0
## 4:                  0             0                     0                     0
## 5:                  0             0                     0                     0
## 6:                  0             0                     0                     0
##    myrica_gale myriophyllum_alterniflorum myriophyllum_farwellii
##          <int>                      <int>                  <int>
## 1:           0                          0                      0
## 2:           0                          0                      0
## 3:           0                          0                      0
## 4:           0                          0                      0
## 5:           0                          0                      0
## 6:           0                          0                      0
##    najas_gracillima nasturtium_officinale nitellopsis_sp nuphar_microphylla
##               <int>                 <int>          <int>              <int>
## 1:                0                     0             NA                  0
## 2:                0                     0             NA                  0
## 3:                0                     0             NA                  0
## 4:                0                     0             NA                  0
## 5:                0                     0             NA                  0
## 6:                0                     0             NA                  0
##    nymphaea_leibergii nymphaeaceae_taxa persicaria_sp persicaria_lapathifolia
##                 <int>             <int>         <int>                   <int>
## 1:                  0                 0             0                       0
## 2:                  0                 0             0                       0
## 3:                  0                 0             0                       0
## 4:                  0                 0             0                       0
## 5:                  0                 0             0                       0
## 6:                  0                 0             0                       0
##    poaceae_taxa potamogeton_bicupulatus potamogeton_diversifolius
##           <int>                   <int>                     <int>
## 1:            0                       0                         0
## 2:            0                       0                         0
## 3:            0                       0                         0
## 4:            0                       0                         0
## 5:            0                       0                         0
## 6:            0                       0                         0
##    potamogeton_hillii potamogeton_vaseyi ricciocarpos_natans ruppia_cirrhosa
##                 <int>              <int>               <int>           <int>
## 1:                  0                  0                   0               0
## 2:                  0                  0                   0               0
## 3:                  0                  0                   0               0
## 4:                  0                  0                   0               0
## 5:                  0                  0                   0               0
## 6:                  0                  0                   0               0
##    salix_sp schoenoplectus_subterminalis schoenoplectus_x_oblongus
##       <int>                        <int>                     <int>
## 1:        0                            0                         0
## 2:        0                            0                         0
## 3:        0                            0                         0
## 4:        0                            0                         0
## 5:        0                            0                         0
## 6:        0                            0                         0
##    scirpus_atrovirens scirpus_cyperinus scolochloa_festucacea
##                 <int>             <int>                 <int>
## 1:                  0                 0                     0
## 2:                  0                 0                     0
## 3:                  0                 0                     0
## 4:                  0                 0                     0
## 5:                  0                 0                     0
## 6:                  0                 0                     0
##    scorpidium_scorpioides scutellaria_sp scutellaria_lateriflora sium_suave
##                     <int>          <int>                   <int>      <int>
## 1:                      0              0                      NA          0
## 2:                      0              0                      NA          0
## 3:                      0              0                      NA          0
## 4:                      0              0                      NA          0
## 5:                      0              0                      NA          0
## 6:                      0              0                      NA          0
##    solidago_sp sparganium_americanum sparganium_angustifolium sparganium_natans
##          <int>                 <int>                    <int>             <int>
## 1:           0                     0                        0                 0
## 2:           0                     0                        0                 0
## 3:           0                     0                        0                 0
## 4:           0                     0                        0                 0
## 5:           0                     0                        0                 0
## 6:           0                     0                        0                 0
##    sphagnum_sp sphagnum_magellanicum stuckenia_sp tolypella_intricata
##          <int>                 <int>        <int>               <int>
## 1:           0                     0            0                   0
## 2:           0                     0            0                   0
## 3:           0                     0            0                   0
## 4:           0                     0            0                   0
## 5:           0                     0            0                   0
## 6:           0                     0            0                   0
##    triadenum_fraseri utricularia_purpurea verbena_sp veronica_americana
##                <int>                <int>      <int>              <int>
## 1:                 0                    0          0                 NA
## 2:                 0                    0          0                 NA
## 3:                 0                    0          0                 NA
## 4:                 0                    0          0                 NA
## 5:                 0                    0          0                 NA
## 6:                 0                    0          0                 NA
##    wolffia_borealis heteranthera_sp ranunculus_sceleratus   guid
##               <int>           <int>                <lgcl> <lgcl>
## 1:                0               0                    NA     NA
## 2:                0               0                    NA     NA
## 3:                0               0                    NA     NA
## 4:                0               0                    NA     NA
## 5:                0               0                    NA     NA
## 6:                0               0                    NA     NA
##    decodon_verticillatus spirogyra_sp lemnaceae_taxa elodea_sp.1
##                   <lgcl>        <int>         <lgcl>      <lgcl>
## 1:                    NA           NA             NA          NA
## 2:                    NA           NA             NA          NA
## 3:                    NA           NA             NA          NA
## 4:                    NA           NA             NA          NA
## 5:                    NA           NA             NA          NA
## 6:                    NA           NA             NA          NA
##    comarum_palustre scirpus_sp.1 lysimachia_sp.1 typha_sp.1
##               <int>       <lgcl>          <lgcl>     <lgcl>
## 1:                0           NA              NA         NA
## 2:                0           NA              NA         NA
## 3:                0           NA              NA         NA
## 4:                0           NA              NA         NA
## 5:                0           NA              NA         NA
## 6:                0           NA              NA         NA
##    potamogeton_obtusifolius.1 glyceria_canadensis utricularia_intermedia.1
##                        <lgcl>              <lgcl>                   <lgcl>
## 1:                         NA                  NA                       NA
## 2:                         NA                  NA                       NA
## 3:                         NA                  NA                       NA
## 4:                         NA                  NA                       NA
## 5:                         NA                  NA                       NA
## 6:                         NA                  NA                       NA
##    myriophyllum_sp.1 percent_biovolume plant_height.1 spirodela_sp
##               <lgcl>             <num>          <num>        <int>
## 1:                NA                NA             NA           NA
## 2:                NA                NA             NA           NA
## 3:                NA                NA             NA           NA
## 4:                NA                NA             NA           NA
## 5:                NA                NA             NA           NA
## 6:                NA                NA             NA           NA
##    vallisneria_sp fontinalis_sp unk_sp.1 nitella_sp.1 cyanobacteria
##             <int>        <lgcl>    <int>        <int>         <int>
## 1:             NA            NA       NA           NA            NA
## 2:             NA            NA       NA           NA            NA
## 3:             NA            NA       NA           NA            NA
## 4:             NA            NA       NA           NA            NA
## 5:             NA            NA       NA           NA            NA
## 6:             NA            NA       NA           NA            NA
##    nitella_mucronata andromeda_polifolia.1 eleocharis_palustris.1
##               <lgcl>                <lgcl>                  <int>
## 1:                NA                    NA                     NA
## 2:                NA                    NA                     NA
## 3:                NA                    NA                     NA
## 4:                NA                    NA                     NA
## 5:                NA                    NA                     NA
## 6:                NA                    NA                     NA
##    myriophyllum_sibiricum.1 persicaria_amphibia.1 potamogeton_sp.1
##                       <int>                 <int>            <int>
## 1:                       NA                    NA                0
## 2:                       NA                    NA                0
## 3:                       NA                    NA                0
## 4:                       NA                    NA                0
## 5:                       NA                    NA                0
## 6:                       NA                    NA                0
##    ranunculus_aquatilis.1 schoenoplectus_sp.1 schoenoplectus_tabernaemontani.1
##                     <int>               <int>                            <int>
## 1:                     NA                  NA                                0
## 2:                     NA                  NA                               NA
## 3:                     NA                  NA                               NA
## 4:                     NA                  NA                               NA
## 5:                     NA                  NA                               NA
## 6:                     NA                  NA                               NA
##    sparganium_sp.1 sparganium_sp.2 utricularia_vulgaris.1
##              <int>           <int>                  <int>
## 1:               0              NA                     NA
## 2:               0              NA                     NA
## 3:               0              NA                     NA
## 4:               0              NA                     NA
## 5:               0              NA                     NA
## 6:               0              NA                     NA
##    spirodela_polyrrhiza.1
##                     <int>
## 1:                     NA
## 2:                     NA
## 3:                     NA
## 4:                     NA
## 5:                     NA
## 6:                     NA
  rawdata[ , .N , .(SURVEY_START, DOW) ]
##      SURVEY_START      DOW     N
##            <char>    <int> <int>
##   1:    6/25/2008  1000100    85
##   2:    6/18/2012  1010400    34
##   3:     6/8/2011  1010500    80
##   4:    5/24/2010  1014200   216
##   5:    6/21/2012  1014900    43
##  ---                            
## 956:    6/20/2005 86023400   181
## 957:    6/25/2017 86025200   836
## 958:    6/27/2013 86025500    39
## 959:    4/22/2017 86026400   158
## 960:    6/20/2007 86047000    33
  names(rawdata)[str_detect(names(rawdata), "pota")]
##  [1] "potamogeton_crispus"        "potamogeton_amplifolius"   
##  [3] "potamogeton_foliosus"       "potamogeton_pusillus"      
##  [5] "potamogeton_robbinsii"      "potamogeton_zosteriformis" 
##  [7] "potamogeton_friesii"        "potamogeton_gramineus"     
##  [9] "potamogeton_illinoensis"    "potamogeton_natans"        
## [11] "potamogeton_nodosus"        "potamogeton_praelongus"    
## [13] "potamogeton_richardsonii"   "potamogeton_strictifolius" 
## [15] "potamogeton_sp"             "potamogeton_obtusifolius"  
## [17] "potamogeton_alpinus"        "potamogeton_perfoliatus"   
## [19] "potamogeton_epihydrus"      "potamogeton_spirillus"     
## [21] "potamogeton_bicupulatus"    "potamogeton_diversifolius" 
## [23] "potamogeton_hillii"         "potamogeton_vaseyi"        
## [25] "potamogeton_obtusifolius.1" "potamogeton_sp.1"
#alltime max vet depth 
  
  a <- rawdata[ , .("survey_ident"= .GRP, "totnsamp" = .N, "clpN" = sum(potamogeton_crispus >= 1, na.rm = T), "lat_median" = median(latitude, na.rm = T), "lon_median" = median(longitude, na.rm = T)) ,   , .(SURVEY_START, DOW) ][ , clpfoc := clpN/totnsamp ,]
  
  
  #get snow data https://www.wrcc.dri.edu/cgi-bin/cliMAIN.pl?mn5435
snow <- fread("scripts&data/data/input/MSP_snowfall_alltime.csv")
  snow
##     Winter_end_year   JUL   AUG   SEP   OCT   NOV   DEC   JAN   FEB   MAR   APR
##               <int> <int> <int> <num> <num> <num> <num> <num> <num> <num> <num>
##  1:            1939     0     0   0.0   1.9   0.5   9.1   7.4  11.0   6.0   3.9
##  2:            1940     0     0   0.0   0.6   0.0   4.8   5.0   9.1  25.6   0.0
##  3:            1941     0     0   0.0   0.0  26.3  10.6   3.3   5.5   6.8   0.0
##  4:            1942     0     0   0.0   0.0   3.8   8.6   1.7   5.2   4.6   0.0
##  5:            1943     0     0   1.7   0.3   0.9   7.0  10.1   4.6   9.8   0.0
##  6:            1944     0     0   0.0   0.0  10.3   0.0   1.0   4.2  11.1   0.3
##  7:            1945     0     0   0.0   0.0   2.5   1.1   8.2  15.4   0.7   6.0
##  8:            1946     0     0   0.0   0.0   4.5  14.6   4.3  11.9   1.5   0.1
##  9:            1947     0     0   0.0   0.0   4.1   5.9   7.6   1.9   3.3   2.0
## 10:            1948     0     0   0.0   0.0  21.8   6.7   3.5  11.6   5.2   0.3
## 11:            1949     0     0   0.0   0.0   2.5   2.3  12.5   3.4   8.3   9.3
## 12:            1950     0     0   0.0   0.0   2.7   6.5  17.0   7.9  11.1   6.4
## 13:            1951     0     0   0.0   0.0   5.6  25.0   7.1   8.6  40.0   2.6
## 14:            1952     0     0   0.0   0.8  10.8  16.5   9.9  15.0  25.4   0.6
## 15:            1953     0     0   0.0   0.0  10.1   6.0   6.0  13.4   6.7   0.7
## 16:            1954     0     0   0.0   0.0   1.9   5.9   3.6   1.0  10.7   0.2
## 17:            1955     0     0   0.0   0.4   6.4   4.0   7.8  11.0   4.3   0.0
## 18:            1956     0     0   0.0   2.5   6.0  14.6   4.6   2.4  14.0   1.1
## 19:            1957     0     0   0.0   0.0   6.8   2.1   4.9   8.7   7.0   9.6
## 20:            1958     0     0   0.0   0.0  10.3   2.2   2.4   1.2   3.5   1.6
## 21:            1959     0     0   0.0   0.0   3.3   2.4   1.4   6.3   5.7   0.0
## 22:            1960     0     0   0.0   3.7   6.9   3.5   9.5   2.7   5.5   0.0
## 23:            1961     0     0   0.0   0.0   2.4   1.7   4.6   8.7  15.1   7.7
## 24:            1962     0     0   0.1   0.0   2.5  18.1   5.9  26.5  21.8   6.4
## 25:            1963     0     0   0.0   0.0   5.6   3.2   5.0   5.4   9.8   5.5
## 26:            1964     0     0   0.0   0.0   0.0   7.6   5.0   1.0   9.7   5.6
## 27:            1965     0     0   0.0   0.0   4.3   8.1  10.5  11.7  37.1   2.0
## 28:            1966     0     0   0.0   0.0   1.6   1.2  11.9   6.8  14.2   0.4
## 29:            1967     0     0   0.0   0.2   3.4  12.7  35.3  23.7   2.6   0.2
## 30:            1968     0     0   0.0   0.3   0.8   2.4  10.6   2.2   0.8   0.4
## 31:            1969     0     0   0.0   0.0   4.9  28.7  21.6   5.3   7.3   0.3
## 32:            1970     0     0   0.0   2.4   3.8  33.2   9.8   4.3   8.6   1.3
## 33:            1971     0     0   0.0   0.0   6.3   5.5  19.9  13.9   7.0   1.9
## 34:            1972     0     0   0.0   0.0  13.4  12.8  12.2   7.6  10.4   8.0
## 35:            1973     0     0   0.0   0.0   1.1  15.3  11.6  11.3   0.4   2.0
## 36:            1974     0     0   0.0   0.0   0.1  17.9   2.5  15.7   7.7   7.3
## 37:            1975     0     0   0.0   0.0   1.2   6.1  27.4   9.0  18.3   2.2
## 38:            1976     0     0   0.0   0.0  16.2   5.6  12.8   5.1  13.6   0.0
## 39:            1977     0     0   0.0   2.3   1.4   8.3  13.4   1.8  14.6   1.8
## 40:            1978     0     0   0.0   3.0  11.7  14.2   6.8   4.6   8.5   1.9
## 41:            1979     0     0   0.0   0.0  16.5  15.1  14.2  13.5   8.4   0.7
## 42:            1980     0     0   0.0   0.0   7.7   1.7  12.9   8.8  13.7   8.5
## 43:            1981     0     0   0.0   0.0   0.9   2.8   4.6  11.0   0.1   1.7
## 44:            1982     0     0   0.0   0.9  14.0  10.6  46.4   7.4  10.9   4.8
## 45:            1983     0     0   0.0   1.4   3.6  19.3   3.2  10.8  14.3  21.8
## 46:            1984     0     0   0.0   0.0  30.4  21.0  10.8   9.3  17.3   9.8
## 47:            1985     0     0   0.0   0.3   2.0  16.3  13.1   4.2  36.8   0.0
## 48:            1986     0     0   0.4   0.0  23.9  13.5  10.3  12.3   8.7   0.4
## 49:            1987     0     0   0.0   0.0   4.4   4.2   5.5   1.2   2.1   0.0
## 50:            1988     0     0   0.0   0.3   4.5   7.5  19.5   4.5   3.7   2.4
## 51:            1989     0     0   0.0   0.2  15.8   7.2   6.0  17.3  22.7   0.8
## 52:            1990     0     0   0.0   0.0  11.3   7.0   1.1  10.7   3.2   2.2
## 53:            1991     0     0   0.0   0.0   5.0  11.7   6.5  14.2   4.4   1.5
## 54:            1992     0     0   0.0   8.2  46.9   6.7   5.0   5.9  10.8   0.6
## 55:            1993     0     0   0.0   1.3  12.2   9.2  12.0   5.3   6.9   0.5
## 56:            1994     0     0   0.0   0.0   7.7   4.5  24.3  12.0   1.7   5.5
## 57:            1995     0     0   0.0   0.0   6.2   6.5   4.2   2.1  10.4   0.2
## 58:            1996     0     0   0.0   0.7   6.6  16.1  14.5   1.2  14.1   2.3
## 59:            1997     0     0   0.0   0.0  16.8  23.7  14.2   4.0  14.3   0.6
## 60:            1998     0     0   0.0   0.0   8.6   3.3  20.4   1.1  11.6   0.0
## 61:            1999     0     0   0.0   0.0   0.1   3.1  33.1   4.2  16.0   0.0
## 62:            2000     0     0   0.0   0.0   0.7   7.3  18.2   7.7   1.0   1.3
## 63:            2001     0     0   0.0   0.0   9.8  30.2   9.4  16.5   8.6   1.3
## 64:            2002     0     0   0.0   0.1   9.4   8.0   9.5   3.1  15.7  20.2
## 65:            2003     0     0   0.0   0.6   1.4   3.0   5.1  10.7  13.2   1.0
## 66:            2004     0     0   0.0   0.0   9.4  16.1  10.7  19.7  10.4   0.0
## 67:            2005     0     0   0.0   0.0   0.5   1.8   8.6   8.0   6.6   0.0
## 68:            2006     0     0   0.0   0.0   5.1  14.5   2.3   2.1  20.4   0.0
## 69:            2007     0     0   0.0   0.0   0.2   4.3   5.5  12.6  11.0   1.9
## 70:            2008     0     0   0.0   0.0   0.4  18.1   2.0   4.8  18.0   1.6
## 71:            2009     0     0   0.0   0.0   4.3  17.4   8.4  10.9   1.5   2.5
## 72:            2010     0     0   0.0   2.8   0.0  20.9   3.1  13.9   0.0   0.0
## 73:            2011     0     0   0.0   0.0   9.8  33.6  17.0  16.1   8.2   1.9
## 74:            2012     0     0   0.0   0.0   3.0   7.3   4.6   6.1   1.3   0.0
## 75:            2013     0     0   0.0   0.0   0.8  15.0   4.6  15.1  13.8  17.9
## 76:            2014     0     0   0.0   0.0   1.1  15.9  22.7  18.4   4.7   7.0
## 77:            2015     0     0   0.0   0.0   9.4   5.6   5.4   4.9   6.8   0.3
## 78:            2016     0     0   0.0   0.0   5.1   9.5   4.1  12.1   5.4   0.5
## 79:            2017     0     0   0.0   0.0   2.3  15.8   8.4   0.3   4.7   0.5
## 80:            2018     0     0   0.0   0.1   0.6   6.4  20.4  15.9   8.8  26.1
## 81:            2019     0     0   0.0   0.3   4.0   6.7   6.8  39.0  10.5   9.8
## 82:            2020     0     0   0.0   0.0  14.3  11.3   9.8   7.5   1.3   7.3
## 83:            2021     0     0   0.0   9.3   8.8  12.4   7.8   5.9   4.0   0.5
## 84:            2022     0     0   0.0   0.0   1.2  21.5  10.5  10.3   5.1   1.6
## 85:            2023     0     0   0.0   0.4  13.0  19.8  22.3  15.5  15.5   3.8
## 86:            2024     0     0   0.0   2.7   0.5   2.1   2.0   7.0  15.2   0.0
##     Winter_end_year   JUL   AUG   SEP   OCT   NOV   DEC   JAN   FEB   MAR   APR
##       MAY   JUN   ANN
##     <num> <int> <num>
##  1:   0.0     0  39.8
##  2:   0.0     0  45.1
##  3:   0.0     0  52.5
##  4:   0.0     0  23.9
##  5:   0.0     0  34.4
##  6:   0.0     0  26.9
##  7:   0.0     0  33.9
##  8:   3.0     0  39.9
##  9:   0.2     0  25.0
## 10:   0.0     0  49.1
## 11:   0.0     0  38.3
## 12:   0.0     0  51.6
## 13:   0.0     0  88.9
## 14:   0.0     0  79.0
## 15:   0.0     0  42.9
## 16:   2.4     0  25.7
## 17:   0.0     0  33.9
## 18:   0.0     0  45.2
## 19:   0.0     0  39.1
## 20:   0.0     0  21.2
## 21:   0.0     0  19.1
## 22:   0.0     0  31.8
## 23:   0.0     0  40.2
## 24:   0.0     0  81.3
## 25:   0.0     0  34.5
## 26:   0.0     0  28.9
## 27:   0.0     0  73.7
## 28:   0.0     0  36.1
## 29:   0.3     0  78.4
## 30:   0.0     0  17.5
## 31:   0.0     0  68.1
## 32:   0.0     0  63.4
## 33:   0.2     0  54.7
## 34:   0.0     0  64.4
## 35:   0.0     0  41.7
## 36:   0.0     0  51.2
## 37:   0.0     0  64.2
## 38:   1.2     0  54.5
## 39:   0.0     0  43.6
## 40:   0.0     0  50.7
## 41:   0.0     0  68.4
## 42:   0.0     0  53.3
## 43:   0.0     0  21.1
## 44:   0.0     0  95.0
## 45:   0.0     0  74.4
## 46:   0.0     0  98.6
## 47:   0.0     0  72.7
## 48:   0.0     0  69.5
## 49:   0.0     0  17.4
## 50:   0.0     0  42.4
## 51:   0.1     0  70.1
## 52:   0.0     0  35.5
## 53:   0.3     0  43.6
## 54:   0.0     0  84.1
## 55:   0.0     0  47.4
## 56:   0.0     0  55.7
## 57:   0.0     0  29.6
## 58:   0.0     0  55.5
## 59:   0.0     0  73.6
## 60:   0.0     0  45.0
## 61:   0.0     0  56.5
## 62:   0.0     0  36.2
## 63:   0.0     0  75.8
## 64:   0.0     0  66.0
## 65:   0.0     0  35.0
## 66:   0.0     0  66.3
## 67:   0.0     0  25.5
## 68:   0.0     0  44.4
## 69:   0.0     0  35.5
## 70:   0.0     0  44.9
## 71:   0.0     0  45.0
## 72:   0.0     0  40.7
## 73:   0.0     0  86.6
## 74:   0.0     0  22.3
## 75:   0.5     0  67.7
## 76:   0.0     0  69.8
## 77:   0.0     0  32.4
## 78:   0.0     0  36.7
## 79:   0.0     0  32.0
## 80:   0.0     0  78.3
## 81:   0.0     0  77.1
## 82:   0.0     0  51.5
## 83:   0.0     0  48.7
## 84:   0.0     0  50.2
## 85:   0.0     0  90.3
## 86:   0.0     0  29.5
##       MAY   JUN   ANN
#add snow to plant abund data:
  a[ , date := as.IDate(SURVEY_START, format = "%m/%d/%Y") , ]
  a[ , year := year(date) , ]
  
  
  a[snow, on = .(year = Winter_end_year ) , annual_snowfall := ANN]

a[ ,.N , DOW][N>2, DOW]
##  [1] 62005500 62022500 27071100 81000300 80003400  2000400 62000600 40000200
##  [9] 70002200 34003200 27006202 27009501 27011700 27104200 27104501 41004300
## [17] 27002800 27004800 27004500 70006900 70009100 27004400 27019200  2000900
## [25] 10000200 27007000 70005000 82009999 82011800 27010400 71014500 71014700
## [33] 62001100 10004401 10004800 27018600 82010100 82010300 10001300 10004402
## [41] 27005500 18024300 49013300 77004600 62000100 73015100 10004100 10008800
## [49] 29025000 13002700 62007500 27007100 27011800  3010700 10004200 19002200
## [57] 27007800 10004500 62005400 71001300 27019101 62023100 27019102 83004300
## [65] 47002600 47003200 73003700 10005300 19002500 82010400 27003501 82016300
## [73] 27013300 10004300 62004700 30013500 27062700 61000600 27003502 62005600
## [81] 10000700 66001800 62004800 82010600 82010900 10005100 86013900 82007400
## [89] 82001000 82010700 82000400
a[ , , ]  
## Key: <SURVEY_START, DOW>
##      SURVEY_START      DOW survey_ident totnsamp  clpN lat_median lon_median
##            <char>    <int>        <int>    <int> <int>      <num>      <num>
##   1:     1/1/2010 62005500            1       53    25         NA         NA
##   2:     1/1/2011  2009100            2      147     3         NA         NA
##   3:     1/1/2013 62007100            3       50     3         NA         NA
##   4:    2/22/2022 62022500            4       12     2         NA         NA
##   5:    3/16/2021 27071100            5      125    16   44.97005  -93.38890
##  ---                                                                        
## 956:     6/9/2017 62004700          956       45    20         NA         NA
## 957:     6/9/2022 10004402          957      108     5   44.86521  -93.68036
## 958:     6/9/2022 27007800          958      175    30         NA         NA
## 959:     6/9/2022 27010400          959      185    75         NA         NA
## 960:     6/9/2022 62005400          960       55     2         NA         NA
##          clpfoc       date  year annual_snowfall
##           <num>     <IDat> <int>           <num>
##   1: 0.47169811 2010-01-01  2010            40.7
##   2: 0.02040816 2011-01-01  2011            86.6
##   3: 0.06000000 2013-01-01  2013            67.7
##   4: 0.16666667 2022-02-22  2022            50.2
##   5: 0.12800000 2021-03-16  2021            48.7
##  ---                                            
## 956: 0.44444444 2017-06-09  2017            32.0
## 957: 0.04629630 2022-06-09  2022            50.2
## 958: 0.17142857 2022-06-09  2022            50.2
## 959: 0.40540541 2022-06-09  2022            50.2
## 960: 0.03636364 2022-06-09  2022            50.2
ggplot(a[DOW %in% a[ ,.N , DOW][N>2, DOW], , ], aes( annual_snowfall, clpfoc), )+
   geom_point()+
   geom_smooth(method = "lm")+
   facet_wrap(~DOW, scales = "free")
## `geom_smooth()` using formula = 'y ~ x'

a <- ggplot(a[DOW %in% a[ ,.N , DOW][N>2, DOW], , ], aes( annual_snowfall, clpfoc, group = as.factor(DOW)), )+
  geom_point( aes(color = DOW) )+
  geom_smooth(method = "lm", se = F, aes(color = DOW) )


ggplotly(a)
## `geom_smooth()` using formula = 'y ~ x'

So, from that plot I’d say the answer is that